<?php
$servername = "mysql.5.6";
$username = "root";
$password = "";
 
try {
    $conn = new PDO("mysql:host=$servername;", $username, $password);
    echo "连接成功";
    // 连接完成后，关闭连接
    $conn = null;
}
catch(PDOException $e)
{
    echo $e->getMessage();
}
?>